package com.gitee.wsl.model.process


import com.gitee.wsl.model.plugin.ModelPlugin
import com.gitee.wsl.model.plugin.createPlugin

typealias ProcessModelPlugin<PluginConfig,TPlugin> = ModelPlugin<ProcessModel, PluginConfig,TPlugin>

fun createProcessPlugin(
    name: String,
    body: ProcessModelPluginBuilder<Unit>.() -> Unit
) = createProcessPlugin(name, {}, body)


fun <PluginConfigT> createProcessPlugin(
    name: String,
    createConfiguration: () -> PluginConfigT,
    body: ProcessModelPluginBuilder<PluginConfigT>.() -> Unit
) = createPlugin<
        ProcessModel,
        PluginConfigT,
        ProcessModelPluginBuilder<PluginConfigT>,
        ProcessModelPluginInstance<PluginConfigT>>(
    name,
    createConfiguration,
    createModelPluginInstance = { key, configT, body1 -> ProcessModelPluginInstance(key,configT,body1)},
    body
)
